<script type="text/javascript" language="javascript">
(function($) {
/*whatever jQuery stuff*/
	$(function(){
		$('#search_calendar').keyup(function(){
			queryCalendar($(this).val(),0);
		});
	});	
})(jQuery);
/*Query Calendar*/
function queryCalendar(txt_search,offset){
	$('.result').html('Loading...');
	$.ajax({
		type:'post',
		url:web_path+'administrator/search_calendar',
		data:({
			txt_search:txt_search,
			offset:offset
		}),
		dataType:'json'				
	}).done(function(data){
		$('.result').html('');
		$('.result').append('<div style="margin-bottom:6px;">'+
		(data.prevPage!=undefined ? '<a href="javascript:void(0);" onclick="javascript:queryCalendar(\''+txt_search.replace(/'|"/g, "\\'")+'\','+data.prevPage+')" class="button">&lt;</a>':'')+
		(data.nextPage ? '<a href="javascript:void(0);" onclick="javascript:queryCalendar(\''+txt_search.replace(/'|"/g, "\\'")+'\','+data.nextPage+')" class="button">&gt;</a>':'')+
		'<\/div>');
		$.each(data,function(keys,items){
			if(!(keys=="nextPage" || keys=="prevPage")){
				$('.result').append('<div>'+
				'<a href="javascript:void(0);" class="tools plus" onclick="javascript:parent.addRemoveList(\'calendar_id\','+items.calendar_id+',\''+items.calendar_subject.replace(/'|"/g, "\\'")+'\')" style="top:-1px;"></a> '+items.calendar_id+' - '+items.calendar_subject+''+
				'<\/div>');						
			}
		});
	});	
}
</script>
<div class="wrap">
	<div class="icon32" id="icon-tools"><br /></div><h2>Search Calendar</h2>
	<table cellspacing="0" cellpadding="0" border="0" class="form-table">
		<tr>
			<td><input id="search_calendar" name="search_calendar" class="medium-text"/></td>
		</tr>
		<tr>
			<td class="result"></td>
		</tr>
	</table>
</div>